<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/5/25 0025
 * Time: 上午 11:53
 */
header("Access-Control-Allow-Origin:*");
    if(!empty($_POST)){
       $tel = $_POST["userTel"];
        $pwd = $_POST["userPwd"];
        $email = $_POST["userEmail"];
        $username = $_POST["userName"];
        sleep(1);
        //1.配置连接参数
        //数据库的ip地址
        $dbserver = "127.0.0.1";
        $dbuser = "root";
        $dbpwd = "";
        $database = "dbreg1704"; //库名称
        // 2.创建连接对象
        $con = new mysqli($dbserver, $dbuser, $dbpwd, $database);
        mysqli_query($con,"set names utf8");
        $mysql = "INSERT INTO userinfo(utel,upwd,uemail,uname) VALUES('".$tel."','".$pwd."','".$email."','".$username."')";
        $result= $con->query($mysql);
        $arr = array("status"=>$result);
       print_r(json_encode($arr));
        $con->close();
    }else{
        $arr = array("status"=>"0");
        print_r(json_encode( $arr ));
    }

